<?php
/* 
* @Title:  [后台订单控制器]
* @Author: {chenlei} [chenleib5@126.com]
* @Date:   2014-04-19 21:06:59
* @Last Modified by:   Administrator
* @Last Modified time: 2014-04-20 16:03:14
* @Copyright:  [hn7m.com]
*/
class OrderControl extends CommonControl{
	public $orderModel=NULL;	//订单表
	public $listModel=NULL; 	//订单列表
	/**
	 * [__init 自动加载模型]
	 * @return [type] [description]
	 */
	public function __init(){
		parent::__init();
		$this->orderModel=K('Order');
		$this->listModel=K('OrderList');
	}
	/**
	 * [index 默认显示订单列表]
	 * @return [type] [description]
	 */
	public function index(){
		$order=$this->orderModel->get_data();
		$this->assign('order',$order);
		$this->display();
	}
	/**
	 * [show_order 显示订单]
	 * @return [type] [description]
	 */
	public function show_order(){
		$oid=Q('get.oid',0,'intval');
		$order=$this->orderModel->get_one_data(array('oid'=>$oid));
		$this->assign('order',$order);  //分配订单ID;

		$list=$this->listModel->get_data(array('qm_order_oid'=>$oid));
		foreach ($list as $key => $value) {
			$list[$key]['name']=K('Goods')->get_onedate_value($value['qm_goods_gid'],'gname');
			$list[$key]['combine']=K('Combine')->switch_bcontent($value['qm_combine_bid']);
		}
		$this->assign('list',$list);//分配订单列表

		if(IS_POST){
			$this->orderModel->update_state($oid,3);
			$this->success('发货成功!',U('index'));
		}
		$this->display();
	}
}
?>